<ui:fragment xmlns="http://www.w3.org/1999/xhtml"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:p="http://primefaces.org/ui"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:j="http://tags">
    <h:form id="FrmPerfil">
        <p:remoteCommand id="cmdVisualizarPerfil"
                         name="visualizarPerfil"
                         update="pnlPerfil"
                         oncomplete="$('#modal-perfil').modal('show'); return false;"/>

        <p:remoteCommand id="cmdSalvarPerfil"
                         name="salvarPerfil"
                         actionListener="#{sessionController.salvarPerfil()}"
                         oncomplete="$('#modal-perfil').modal('hide'); return false;"/>

        <p:remoteCommand id="cmdCancelarPerfil"
                         name="cancelarPerfil"
                         oncomplete="$('#modal-perfil').modal('hide'); return false;"/>

        <div id="modal-perfil" class="modal hide fade">
            <div class="modal-header">
                <h:panelGrid columns="2" cellpadding="5">
                    <p:graphicImage value="/resources/img/user.png" />
                    <h3 id="modal-title">#{sessionController.usuarioLogadoNome}</h3>
                </h:panelGrid>
            </div>
            <div class="modal-body">
                <p class="center" id="modal-content">
                    <h:panelGrid id="pnlPerfil"
                                 columns="2"
                                 cellpadding="5" cellspacing="5"
                                 style="width: 500px;">
                        <h:outputLabel value="Grupo:"
                                       style="font-weight: bold; text-align: right;"/>
                        <h:outputLabel value="#{sessionController.usuarioLogado.ugrNome}"/>

                        <h:outputLabel value="Nome:"
                                       style="font-weight: bold; text-align: right;"/>

                        <p:outputPanel styleClass="input-prepend">
                            <span class="add-on"><i class="icon-font"></i></span>
                            <h:inputText id="txtUsuNome"
                                         value="#{sessionController.usuarioLogado.usuNome}"
                                         class="input-block-level"
                                         style="width: 100%;"/>
                        </p:outputPanel>

                        <h:outputLabel value="E-mail:"
                                       style="font-weight: bold; text-align: right;"/>

                        <p:outputPanel styleClass="input-prepend">
                            <span class="add-on"><i class="icon-envelope"></i></span>
                            <h:inputText id="txtUsuEmail"
                                         value="#{sessionController.usuarioLogado.usuEmail}"
                                         class="input-block-level"
                                         style="width: 100%;"/>
                        </p:outputPanel>
                    </h:panelGrid>
                </p>
            </div>
            <div class="modal-footer">
                <button id="btnSalvarPerfil"
                        type="button"
                        class="btn btn-primary"
                        onclick="salvarPerfil();">
                    <i class="icon-ok icon-white"></i>
                    Salvar
                </button>

                <button id="btnCancelarPerfil"
                        type="button"
                        class="btn"
                        onclick="cancelarPerfil();">
                    <i class="icon-remove"></i>
                    Cancelar
                </button>
            </div>
        </div>
    </h:form>
</ui:fragment>